/**
 * Handle record selected.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"8C15F18D-9B23-4CDC-ADC0-A8735259C861"}
 */
function onRecordSelection(event) {
	if (re_excursio_id != null)
	{
		var $rel = reservaexc_to_excursiones.excursiones_to_excursiondh
		var $nrec = $rel.getSize()
		if ($nrec == 0)
		{
			globals.DIALOGS.showErrorDialog('Error','No existe Tipo de Excursión','OK')
			return
		}
		var $muestra = new Array()
		var $devuelve = new Array()
		for (var i = 1 ; i <= $rel.getSize() ; i++)
		{
				var $reg 		= $rel.getRecord(i)
				var $comercial 	= $reg.excudh_comercial
				var $id 		= $reg.excudh_id
				$muestra.push($comercial)
				$devuelve.push($id)
		}
		application.setValueListItems('jornada_manual',$muestra, $devuelve)
	}	
	
	//if (reservaexc_to_excursiones)
	//{
		//var $rel = reservaexc_to_excursiones.excursiones_to_mnemotec.mnemotec_to_tarifari
		//var $jornada = new Array()
		
		//globals.gProveSeleccionado = reservaexc_to_excursiones.excursiones_to_mnemotec.mnemotec_to_tarifari.tari_hote
		
		//for (var i = 1 ; i <= $rel.getSize() ; i++)
		//{
			//var $reg = $rel.getRecord(i)
			//var $desde = $reg.tari_desde
			//if ($jornada.indexOf($desde,0) == -1)
				//$jornada.push($desde)
		//}
		//application.setValueListItems('desde_exc',$jornada)
	//}	
}

/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"B7495246-7090-47A5-A086-C53A8B5A5B7B"}
 */
function Agregar(event) {
	reservaexc_to_reservajor.newRecord()
	var $pax = reservaexc_to_reservacab.rc_qmayores + reservaexc_to_reservacab.rc_qmenores
	reservaexc_to_reservajor.rj_qpaxs = $pax
}

/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"1DC13D83-29E6-4881-9B29-1942BBE39E34"}
 */
function Eliminar(event) {
	reservaexc_to_reservajor.deleteRecord()	
}

/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"A2518CDD-98A3-4E3C-8785-0A4A6017B0DF"}
 */
function eliminarExcursion(event) {
	reservaexc_to_reservajor.deleteAllRecords()
	controller.deleteRecord()
}
